package com.axend.aerosense.base.bean;


import android.content.res.Resources;

import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

import com.axend.aerosense.base.R;
import com.axend.aerosense.base.app.BaseApplication;
import com.axend.aerosense.base.impl.IBaseContentItem;

@Entity(tableName = "RoomTypeBean")
public class RoomTypeBean extends BaseAdapterBean implements IBaseContentItem {
    @PrimaryKey
    protected int roomType;
    @Ignore
    // 是否被选中, 不加入数据库表中
    public boolean isSelect = false;
    protected String roomName;

    public RoomTypeBean(String roomName, int roomType) {
        this.roomName = roomName;
        this.roomType = roomType;
    }

    public String getRoomName() {
        try{
            Resources res = BaseApplication.getInstance().getApplicationContext().getResources();

            switch (roomType){
                case 1:
                    return res.getString(R.string.base_living_room);
                case 2:
                    return res.getString(R.string.base_bed_room);
                case 3:
                    return res.getString(R.string.base_bathroom);
                case 4:
                    return res.getString(R.string.base_kitchen);
                case 5:
                    return res.getString(R.string.base_dining_room);
                case 6:
                    return res.getString(R.string.base_office);
                default:
                    return res.getString(R.string.base_others);

            }
        }catch (Exception e){
            return roomName;
        }

    }

    public int getRoomType() {
        return roomType;
    }

    @Override
    public String getContent() {
        return getRoomName();
    }

    @Override
    public boolean isSelected() {
        return isSelect;
    }
}
